package cn.gson.tj_springboot.model.pojos;

import javax.persistence.*;
import java.sql.Date;
import java.util.Objects;

@Entity
@Table(name = "user_", schema = "tjcrm", catalog = "")
public class User {
    private int userId;
    private String userName;
    private Date userDate;
    private String userPhoto;
    private Integer userGrade;
    private Integer userManager;

    @Id
    @Column(name = "user_id", nullable = false)
    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "user_name", nullable = true, length = 255)
    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    @Basic
    @Column(name = "user_date", nullable = true)
    public Date getUserDate() {
        return userDate;
    }

    public void setUserDate(Date userDate) {
        this.userDate = userDate;
    }

    @Basic
    @Column(name = "user_photo", nullable = true, length = 255)
    public String getUserPhoto() {
        return userPhoto;
    }

    public void setUserPhoto(String userPhoto) {
        this.userPhoto = userPhoto;
    }

    @Basic
    @Column(name = "user_grade", nullable = true)
    public Integer getUserGrade() {
        return userGrade;
    }

    public void setUserGrade(Integer userGrade) {
        this.userGrade = userGrade;
    }

    @Basic
    @Column(name = "user_manager", nullable = true)
    public Integer getUserManager() {
        return userManager;
    }

    public void setUserManager(Integer userManager) {
        this.userManager = userManager;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        User user = (User) o;
        return userId == user.userId &&
                Objects.equals(userName, user.userName) &&
                Objects.equals(userDate, user.userDate) &&
                Objects.equals(userPhoto, user.userPhoto) &&
                Objects.equals(userGrade, user.userGrade) &&
                Objects.equals(userManager, user.userManager);
    }

    @Override
    public int hashCode() {
        return Objects.hash(userId, userName, userDate, userPhoto, userGrade, userManager);
    }
}
